package list_map;

import java.util.Arrays;

/**
 * @program: javase
 * @description:
 * @author: luolidong
 * @create: 2021-06-29 17:42
 * @version: 1.0
 */
public class StringSort {
    public static void main(String[] args) {
        String[] str=new String[]{"1","10","32","22"};

        Arrays.sort(str);
        System.out.println("默认排序"+Arrays.toString(str));

        Arrays.sort(str,(a,b)->b.compareTo(a));
        System.out.println("自定义降序排序"+Arrays.toString(str));
        //int[] 不能通过比较器自定义排序，使用包装类
        int[] ints=new int[]{23,4,1,56,2};
        Integer[] ints1=new Integer[]{23,4,1,56,2};
        Arrays.sort(ints1,(a,b)->b-a);
        System.out.println(Arrays.toString(ints1));


    }
}
